import request from '@/utils/request'

// 创建审批流程
export const createApprovalFlow = (data) => {
  return request({
    url: '/v1/work/flow',
    method: 'POST',
    data
  })
}

// ----------------------------- New -----------------------------------

// 创建/修改审批模板
export const createApprovalTemplates = (data) => {
  return request({
    url: '/v1/approval/templates',
    method: 'POST',
    data
  })
}

// 获取审批类型
export const getApprovalType = (params) => {
  return request({
    url: `/v1/approval/type`,
    method: 'GET',
    params
  })
}

// 获取审批模板详情
export const getApprovalTemplatesDetails = (params) => {
  return request({
    url: `/v1/approval/templates/details`,
    method: 'GET',
    params
  })
}

// 获取审批模板列表
export const getApprovalTemplatesList = (params) => {
  return request({
    url: `/v1/approval/templates/list`,
    method: 'GET',
    params
  })
}

// 删除审批模板
export const deleteApprovalTemplates = (id) => {
  return request({
    url: `/v1/approval/templates/${id}`,
    method: 'DELETE'
  })
}

// 获取审批记录
export const getApprovalRecords = (params) => {
  return request({
    url: `/v1/approval/example`,
    method: 'GET',
    params
  })
}

// 获取审批记录详情
export const getApprovalRecordsDetails = (params) => {
  return request({
    url: `/v1/approval/instance/details`,
    method: 'GET',
    params
  })
}
